package com.xt.purchasingsystem.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xt.purchasingsystem.mapper.SupplierApprovalDetailsMapper;
import com.xt.purchasingsystem.model.SupplierApprovalDetails;
import com.xt.purchasingsystem.service.SupplierApprovalDetailsService;
import com.xt.purchasingsystem.utils.Result;
import com.xt.purchasingsystem.utils.ResultFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author yhp
 * @since 2020-05-31
 */
@Service
public class SupplierApprovalDetailsServiceImpl extends ServiceImpl<SupplierApprovalDetailsMapper, SupplierApprovalDetails> implements SupplierApprovalDetailsService {
    @Autowired
    private SupplierApprovalDetailsMapper supplierApprovalDetailsMapper;

    @Override
    public Result getSupplierApprovalDetailsByProductId(String supplierId, String productId) {
        SupplierApprovalDetails supplierApprovalDetails = supplierApprovalDetailsMapper.getSupplierApprovalDetailsByProductId(supplierId, productId);
        if (supplierApprovalDetails != null) {
            return ResultFactory.buildSuccessResult("查询成功", supplierApprovalDetails);
        } else {
            return ResultFactory.buildFailResult("查询失败");
        }
    }
}
